package com.derek.omshopping.ui.mine;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.derek.omshopping.MainActivity;
import com.derek.omshopping.R;
import com.derek.omshopping.base.BaseActivity;
import com.derek.omshopping.utils.PackageUtils;

import butterknife.BindView;
import butterknife.ButterKnife;

public class SettingActivity extends BaseActivity implements View.OnClickListener {
    @BindView(R.id.tv_user)
    TextView tvUser;
    @BindView(R.id.tv_pwd)
    TextView tvPwd;
    @BindView(R.id.tv_address)
    TextView tvAddress;
    @BindView(R.id.tv_cache)
    TextView tvCache;
    @BindView(R.id.weixin_gift_tv)
    TextView weixinGiftTv;
    @BindView(R.id.tv_weixin)
    TextView tvWeixin;
    @BindView(R.id.version_info)
    TextView versionInfo;
    @BindView(R.id.close)
    ImageView close;
    private AlertDialog.Builder builder;

    @Override
    public void onClick(View v) {
        Intent intent = new Intent();
        switch (v.getId()) {
            case R.id.tv_user:
                intent.setClass(SettingActivity.this, PrivatePersonActivity.class);
                startActivity(intent);
                break;
            case R.id.tv_address:
                intent.setClass(SettingActivity.this, NewAddressActivity.class);
                startActivity(intent);
                break;
            case R.id.tv_pwd:
                intent.setClass(this, PwdUpdateActivity.class);
                startActivity(intent);
                break;
            case R.id.close:
                intent.setClass(this, MainActivity.class);
                startActivity(intent);
                break;
            case R.id.tv_weixin:
                break;
            case R.id.weixin_gift_tv:
                break;
            case R.id.version_info:

                builder.setTitle("温馨提示:").setMessage("当前版本号:" + PackageUtils.getAppVersionName(this) + "\n" + "无须更新");
                builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        if (builder.create().isShowing()) {
                            builder.create().dismiss();
                        }
                    }
                }).setNegativeButton("取消", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        if (builder.create().isShowing()) {
                            builder.create().dismiss();
                        }
                    }
                });
                builder.create().show();
                break;
        }

    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_setting;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
        initView();
    }

    private void initView() {

    }
}